package com.xpf.utils;

import org.apache.commons.codec.binary.Base64;
import java.security.MessageDigest;

public class MD5Utils {
	//加盐加密的盐值
	private static String saltValue = "suijishe88jfa2;f";

	/**
	 * 加盐加密
	 * @param strValue
	 * @return
	 * @throws Exception
	 */
	public static String getMD5Str(String strValue) throws Exception {
		MessageDigest md5 = MessageDigest.getInstance("MD5");
		String newstr = Base64.encodeBase64String(md5.digest((strValue+saltValue).getBytes()));
		return newstr;
	}

	public static void main(String[] args) {
		try {
			String md5 = getMD5Str("123123");
			System.out.println(md5);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
